@extends('layouts.fz')
@section('css')
    <link href="{{asset('assets/css/bootstrap.css')}}" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="{{asset('assets/css/font-awesome.css')}}" rel="stylesheet" />
    <!-- Custom Styles-->
    <link href="{{asset('assets/css/custom-styles.css')}}" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <link href="{{asset('assets/js/dataTables/dataTables.bootstrap.css')}}" rel="stylesheet" />
@endsection

@section('head')
    <h3 class="page-header">

    </h3>
    <ol class="breadcrumb">
        <li><a href="#">主页</a></li>
        <li><a href="#">用户管理</a></li>
        <li class="active">用户列表</li>
    </ol>
@endsection
@section('contain')

    <div class="row">
        <div class="col-md-12">
            <!-- Advanced Tables -->
            <div class="panel panel-default">
                <div class="panel-heading">
                    用户列表
                </div>
                <div class="panel-body">
                    <div class="">
                        <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                            <thead>
                            <tr>
                                <th>用户id</th>
                                <th>用户姓名</th>

                                <th>所属部门</th>
                                <th>部门类型</th>
                                <th>用户操作</th>

                            </tr>
                            </thead>
                            <tbody>
                            @foreach($user as $arr)
                                <tr class="odd gradeX">
                                    <td>{{$arr->id}}</td>
                                    <td>{{$arr->email}}</td>

                                    <td>{{\App\Department::getDepartmentById($arr->department)}}</td>
                                    <td>{{\App\Department::get_department_type($arr->department_type)}}</td>


                                    <td class="center">
                                        <button class="btn btn-primary" onclick="confirmBox('{{url('user_reset_password')}}/{{$arr->id}}')"><i class="fa fa-mail-reply"> </i>重置密码</button>

                                        <button class="btn btn-danger" onclick="confirmBox('{{url("user_delete")}}/{{$arr->id}}')"><i class="fa fa-trash-o"> </i>删除</button>

                                    </td>
                                </tr>
                            @endforeach


                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
            <!--End Advanced Tables -->
        </div>
    </div>

@endsection
@section('js')
    <script src="{{asset('assets/js/jquery-1.10.2.js')}}"></script>
    <!-- Bootstrap Js -->
    <script src="{{asset('assets/js/bootstrap.min.js')}}"></script>
    <!-- Metis Menu Js -->
    <script src="{{asset('assets/js/jquery.metisMenu.js')}}"></script>
    <!-- Custom Js -->

    <script src="{{asset('assets/js/dataTables/jquery.dataTables.js')}}"></script>
    <script src="{{asset('assets/js/dataTables/dataTables.bootstrap.js')}}"></script>
    <script>
        $(document).ready(function () {
            $('#dataTables-example').dataTable({
                "oLanguage": {
                    "sProcessing": "正在获取数据，请稍后...",
                    "sLengthMenu": "显示 _MENU_ 条",
                    "sZeroRecords": "没有您要搜索的内容",
                    "sInfo": "从 _START_ 到  _END_ 条记录 总记录数为 _TOTAL_ 条",
                    "sInfoEmpty": "记录数为0",
                    "sInfoFiltered": "(全部记录数 _MAX_ 条)",
                    "sInfoPostFix": "",
                    "sSearch": "搜索",
                    "sUrl": "",
                    "oPaginate": {
                        "sFirst": "第一页",
                        "sPrevious": "上一页",
                        "sNext": "下一页",
                        "sLast": "最后一页"
                    }
                }
            });
        });
        function confirmBox(url) {
            console.log(url);
            $('#confirmBoxOk').attr('href',url);
            $('#confirmBox').modal()
        }
    </script>
    <script src="{{asset('assets/js/custom-scripts.js')}}"></script>
@endsection